package com.hanthink.system.service.impl.repair;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hanthink.system.domain.repair.MyRepairRecordMessage;
import com.hanthink.system.mapper.repair.MyRepairRecordMapper;
import com.hanthink.system.service.repair.IMyRepairRecordService;

@Service
public class IMyRepairRecordServiceImpl implements IMyRepairRecordService {

	@Autowired
	MyRepairRecordMapper myRepairRecordMapper;

	@Override
	public List<MyRepairRecordMessage> SelectRecordMessage(MyRepairRecordMessage myRepairRecordMessage) {
		return myRepairRecordMapper.SelectRecordMessage(myRepairRecordMessage);
	}

	@Override
	public List<MyRepairRecordMessage> SelectCharMessage(MyRepairRecordMessage myRepairRecordMessage) {

		List<MyRepairRecordMessage> list = myRepairRecordMapper.SelectCharMessage(myRepairRecordMessage);
		if(list.size() > 0) {
			//查询总数量
			List<MyRepairRecordMessage> totalList = myRepairRecordMapper.SelectCharTotalNum(myRepairRecordMessage);
			for(MyRepairRecordMessage record : list) {
				record.setProportion(record.getAmount());
				record.setA(totalList.get(0).getA());
				record.setMemo(record.getName());
			}
		}
		
		return list;
	}

}
